class Solution
{
public:
    vector<vector<int>> subsets(vector<int> &nums)
    {
        vector<vector<int>> result;
        int len = nums.size();
        int noneEmptySubSetCount = (1 << len) - 1;
        result.push_back({});
        for (int mask = 1; mask <= noneEmptySubSetCount; ++mask)
        {
            vector<int> subSet;
            for (int i = 0; i < len; ++i)
            {
                if (mask & (1 << i))
                {
                    subSet.push_back(nums[i]);
                }
            }
            result.push_back(subSet);
        }
        return result;
    }
};